# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Sirat18 <aur@sirat18.de>
# Contributor: Frédérik Paradis <fredy14[at]gmail[dot]com>

pkgbase=libforensic1394
pkgname=('libforensic1394' 'python-libforensic1394')
pkgver=0.2
pkgrel=10
pkgdesc='Library for performing live memory forensics over the IEEE 1394 (FireWire) interface'
url='https://freddie.witherden.org/tools/libforensic1394/'
arch=('loong64' 'x86_64')
license=('LGPL3')
makedepends=('cmake' 'glibc' 'python')
source=(https://freddie.witherden.org/tools/libforensic1394/releases/${pkgname}-${pkgver}.tar.gz{,.sig})
sha512sums=('184434037388f6f1d7a028c81d3c9101b20200b2444e28d5e007c34204ba58e71fb0db8cb1406063f0d4fe06bca80a1795e5a44d7eae52fa1c227f0b0cbf5dbd'
            'SKIP')
validpgpkeys=('509E82C45B8EE8D9926B395CFC9F4433FBA8A957') # Freddie Witherden <freddie@witherden.org>

prepare() {
  cd ${pkgbase}-${pkgver}
  # https://github.com/FreddieWitherden/libforensic1394/issues/2
  sed -i 's/-Werror //' CMakeLists.txt
}

build() {
  cd ${pkgbase}-${pkgver}
  cmake -B build \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -Wno-dev \
    -S .
  make -C build

  cd python
  python setup.py build
}

package_libforensic1394() {
  depends=('glibc')
  cd ${pkgbase}-${pkgver}
  make -C build DESTDIR="${pkgdir}" install
  install -Dm 644 README -t "${pkgdir}/usr/share/doc/${pkgname}"
}

package_python-libforensic1394() {
  depends=('python' 'libforensic1394')
  cd ${pkgbase}-${pkgver}/python
  python setup.py install --root="${pkgdir}" -O1
}

# vim: ts=2 sw=2 et:
